package com.smartStatus.admin.activemq;

import com.alibaba.fastjson.JSONObject;
import com.smartStatus.api.entity.SysUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.DefaultEventListenerFactory;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.jms.annotation.JmsListeners;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.jms.listener.adapter.MessageListenerAdapter;
import org.springframework.stereotype.Component;

import java.util.Iterator;
import java.util.Map;

/**
 * @Author:liuby5
 * @CreateTime:2022-09-01 16:49
 * @Description:mq 监听
 * @Version:1.0
 */


@Component
@Slf4j
public class ActiveMqListener {
    @JmsListener(destination = "first-queue")
    @JmsListener(destination = "second-queue")
    public void receiveMq(String message) {
        SysUser sysUser = JSONObject.parseObject(message, SysUser.class);
        log.info("接收到mq中的数据为:{}", sysUser);
    }
}
